<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <rich:panel>
        <f:facet name="header">#{messages['application.gradecurricular.label']}</f:facet>

		<s:decorate id="curso" template="layout/display.xhtml">
            <ui:define name="label">#{messages['application.curso.label']}</ui:define>
            #{gradeCurricularHome.instance.curso.nomCurso}
        </s:decorate>

        <s:decorate id="numAno" template="layout/display.xhtml">
            <ui:define name="label">#{messages['application.gradecurricular.label.ano']}</ui:define>
            #{gradeCurricularHome.instance.numAno}
        </s:decorate>

        <s:decorate id="numSemestre" template="layout/display.xhtml">
            <ui:define name="label">#{messages['application.gradecurricular.label.semestre']}</ui:define>
            #{gradeCurricularHome.instance.numSemestre}
        </s:decorate>

        <s:decorate id="numPeriodoVigente" template="layout/display.xhtml">
            <ui:define name="label">#{messages['application.gradecurricular.label.periodovigente']}</ui:define>
            #{gradeCurricularHome.instance.numPeriodoVigente}
        </s:decorate>

        <div style="clear:both"/>
        
    </rich:panel>
    
    <div class="actionButtons">      

        <s:button view="/GradeCurricularEdit.xhtml" 
                    id="edit" 
                 value="#{messages['application.label.edit']}"/>

        <s:button view="/#{empty gradeCurricularFrom ? 'GradeCurricularList' : gradeCurricularFrom}.xhtml"
                    id="done"
                 value="#{messages['application.label.done']}"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab label="#{messages['application.turma.label']}">
    <div class="association" id="turmasChildren">
        
        <h:outputText value="#{messages['application.gradecurricular.label.turma.empty']}" 
                   rendered="#{empty gradeCurricularHome.turmas}"/>
        
        <rich:dataTable value="#{gradeCurricularHome.turmas}" 
                       var="turma" 
                  rendered="#{not empty gradeCurricularHome.turmas}" 
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="turmasTable">
            <h:column>
                <f:facet name="header">#{messages['application.turma.label.codigo']}</f:facet>
                <h:outputText value="#{turma.codTurma}"/>
            </h:column>
            <h:column>
                <f:facet name="header">#{messages['application.label.action']}</f:facet>
                <s:link id="selectturma" 
                     value="#{messages['application.label.select']}" 
                      view="/Turma.xhtml">
                    <f:param name="turmaIdtTurma" 
                            value="#{turma.idtTurma}"/>
                    <f:param name="turmaFrom" value="GradeCurricular"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    
    <div class="actionButtons">
        <s:button 
               value="#{messages['application.gradecurricular.label.addturma']}"
                view="/TurmaEdit.xhtml">
            <f:param name="gradeCurricularId" 
                    value="#{gradeCurricularHome.instance.idtGradeCurricular}"/>
            <f:param name="turmaFrom" value="GradeCurricular"/>
        </s:button>
    </div>        
    </rich:tab>

    <rich:tab label="#{messages['application.disciplina.label']}">
    <div class="association" id="discGradeCurricularsChildren">
        
        <h:outputText value="#{messages['application.gradecurricular.label.discgradecurricular.empty']}" 
                   rendered="#{empty gradeCurricularHome.discGradeCurriculars}"/>
        
        <rich:dataTable value="#{gradeCurricularHome.discGradeCurriculars}" 
                       var="discGradeCurricular" 
                  rendered="#{not empty gradeCurricularHome.discGradeCurriculars}" 
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="discGradeCurricularsTable">
            <h:column>
                <f:facet name="header">#{messages['application.disciplina.label.nome']}</f:facet>
                #{discGradeCurricular.disciplina.nomDisciplina}
            </h:column>
            <h:column>
                <f:facet name="header">#{messages['application.gradecurricular.label.numcargahoraria']}</f:facet>
                #{discGradeCurricular.numCargaHoraria}
            </h:column>
            <h:column>
                <f:facet name="header">#{messages['application.label.action']}</f:facet>
                <s:link id="selectdiscGradeCurricular" 
                     value="#{messages['application.label.select']}" 
                      view="/DiscGradeCurricular.xhtml">
                    <f:param name="discGradeCurricularIndGradeCurricular" 
                            value="#{discGradeCurricular.gradeCurricular}"/>
                    <f:param name="discGradeCurricularIndDisciplina" 
                            value="#{discGradeCurricular.disciplina}"/>
                    <f:param name="discGradeCurricularNumCargaHoraria" 
                            value="#{discGradeCurricular.numCargaHoraria}"/>
                    <f:param name="discGradeCurricularFrom" value="GradeCurricular"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    
    <div class="actionButtons">
        <s:button 
               value="#{messages['application.gradecurricular.label.adddiscgradecurricular']}"
                view="/DiscGradeCurricularEdit.xhtml">
            <f:param name="gradeCurricularId" 
                    value="#{gradeCurricularHome.instance.idtGradeCurricular}"/>
            <f:param name="discGradeCurricularFrom" value="GradeCurricular"/>
        </s:button>
    </div>        
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
